#include "gtest/gtest.h"
#include <vector>

using std::vector;

extern vector<vector<int>> Permute(vector<int>& nums);

namespace
{
TEST(Permute, example1)
{
    vector<int>         nums = vector<int>({ 1U, 2U, 3U });
    vector<vector<int>> expected{};
    expected.push_back({ 1U, 2U, 3U });
    expected.push_back({ 1U, 3U, 2U });
    expected.push_back({ 2U, 1U, 3U });
    expected.push_back({ 2U, 3U, 1U });
    expected.push_back({ 3U, 1U, 2U });
    expected.push_back({ 3U, 2U, 1U });

    auto got = Permute(nums);

    ASSERT_EQ(expected.size(), got.size());
    for (size_t i{ 0U }; i < expected.size(); i++) {
        for (size_t j{ 0U }; j < expected[i].size(); j++) {
            ASSERT_EQ(expected[i][j], got[i][j]) << "i: " << i << " j: " << j;
        }
    }
}
TEST(Permute, example2)
{
    vector<int>         nums = vector<int>({ 0U, 1U });
    vector<vector<int>> expected{};
    expected.push_back({ 0U, 1U });
    expected.push_back({ 1U, 0U });

    auto got = Permute(nums);

    ASSERT_EQ(expected.size(), got.size());
    for (size_t i{ 0U }; i < expected.size(); i++) {
        for (size_t j{ 0U }; j < expected.size(); j++) {
            ASSERT_EQ(expected[i][j], got[i][j]);
        }
    }
}
TEST(Permute, example3)
{
    vector<int>         nums = vector<int>({ 1U });
    vector<vector<int>> expected{};
    expected.push_back({ 1U });

    auto got = Permute(nums);

    ASSERT_EQ(expected.size(), got.size());
    for (size_t i{ 0U }; i < expected.size(); i++) {
        for (size_t j{ 0U }; j < expected.size(); j++) {
            ASSERT_EQ(expected[i][j], got[i][j]);
        }
    }
}
}  // namespace